package com.mjr.webmanage.config;


import com.mjr.webmanage.interceptor.DemoInterceptor;
import com.mjr.webmanage.interceptor.TokenInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * 配置类 - 配置拦截器
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private DemoInterceptor demoInterceptor;


    @Autowired
    private TokenInterceptor tokenInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
//        WebMvcConfigurer.super.addInterceptors(registry);

        registry.addInterceptor(tokenInterceptor).addPathPatterns("/**").excludePathPatterns("/login");
//        registry.addInterceptor(demoInterceptop)
//                .addPathPatterns("/**")
//                .excludePathPatterns("/css/**", "/js/**", "/fonts/**", "/img/**");
    }
}
